package main.java.com.sloera.pool;

import java.util.concurrent.CountDownLatch;

/*
 * @Description 使用`jdk/bin/jvisualvm.exe`程序来观察java的堆内存、线程等情况。使用win`资源监视器`查看对应pid占用的系统内存。
 * @Author SloeraN
 * @Date 2020/3/29 13:57
 */
public class MaxThreadsDemo {
    public static void main(String[] args) {
        CountDownLatch countDownLatch = new CountDownLatch(1);
        try {
            Thread.sleep(20000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        for (int i = 0; i < 5000; i++) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        countDownLatch.await();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }).start();
            System.out.println("i=" + i);
        }

    }
}
